package com.milloc.db.util;

import org.apache.commons.lang3.StringUtils;

import javax.persistence.criteria.Predicate;

import static com.google.common.base.Preconditions.checkArgument;

/**
 * @author gongdeming
 * @create 2019-08-27
 */
public class SQLUtils {
    public static final Predicate[] PREDICATE_ARRAY = new Predicate[]{};

    public static String like(String s) {
        checkArgument(StringUtils.isNotBlank(s));
        return "%" + s + "%";
    }

    public static String likeStart(String s) {
        checkArgument(StringUtils.isNotBlank(s));
        return s + "%";
    }

    public static String likeEnd(String s) {
        checkArgument(StringUtils.isNotBlank(s));
        return "%" + s;
    }
}
